package com.qiyu.tech.mysql.config;

import org.mybatis.spring.annotation.MapperScan;
import org.mybatis.spring.annotation.MapperScannerRegistrar;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @Author linhao
 * @Date created in 12:16 下午 2021/1/28
 */
@Component
public class MapperScannerRegistrarConfig extends MapperScannerRegistrar {

    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        Map<String, Object> mapperScanValue = importingClassMetadata.getAnnotationAttributes(MapperScan.class.getName());
        for (String key : mapperScanValue.keySet()) {
            Object value = mapperScanValue.get(key);
            System.out.println("key is " + key + ": value is " + value);
        }
        super.registerBeanDefinitions(importingClassMetadata, registry);
    }
}
